package com.shuoyue.ycgk.ui.papergroups.set;

import android.content.Context;

import com.shuoyue.ycgk.base.baseadapter.IndexFragmentStateAdapter;
import com.shuoyue.ycgk.entity.Type;
import com.shuoyue.ycgk.ui.papergroups.BaseFragmentPaperGroup;
import com.shuoyue.ycgk.ui.papergroups.BasePaperGroupActivity;
import com.shuoyue.ycgk.views.TabLayoutUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 题库列表
 */
public class PaperSetActivity extends BasePaperGroupActivity {

    @Override
    protected void initView() {
        super.initView();
        pageTitle.setText("题库");
    }

    @Override
    public void setTabType(List<Type> type) {

        fragmentMainItems = new ArrayList<>();
        for (Type topType : type) {
            fragmentMainItems.add(FragmentPaperSet.getInstance(topType,false,-1));
        }
        indexFragmentAdapter = new IndexFragmentStateAdapter(getSupportFragmentManager(), fragmentMainItems);
        tabLayout.setupWithViewPager(viewPager);
        viewPager.setOffscreenPageLimit(1);
        viewPager.setAdapter(indexFragmentAdapter);
        refreshlayout.setEnableRefresh(false);
        TabLayoutUtil tabLayoutUtil = new TabLayoutUtil();
        tabLayoutUtil.setTabTextSizeWhenSelect(tabLayout, type);
    }
}
